package com.xigua._查找;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/3/2611:58
 */
public class _278_第一个错误的版本 {

    //1 2 3 4 5 6 7 8 9
    public int firstBadVersion(int n) {
        int start = 1;
        int end = n;
        while (end>start){
            int mid = start+(end-start)/2;
            if (isBadVersion(mid)){
                end = mid;
            }else {
                start = mid+1;
            }
        }
        return start;
    }

    boolean isBadVersion(int version){
        return true;
    }

}
